package com.hrvsr.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PropertyUtil {
	private static Logger logger = LoggerFactory.getLogger(PropertyUtil.class);
	private static Properties props = init();

	private static Properties init() {
		InputStream in = null;
		try {
			in = PropertyUtil.class.getClassLoader().getResourceAsStream("hrvsr.properties");
			Properties props = new Properties();
			props.load(in);
			return props;
		} catch (IOException e) {
			logger.error("error initing HRVSR properties", e);
		} finally {
			IOUtils.closeQuietly(in);
		}
		return null;
	}

	public static String getProperty(String property) {
		return props == null ? null : props.getProperty(property);
	}
}
